<?php namespace Phpcmf\Controllers;

class Home extends \Phpcmf\Home\Module
{

	public function index() {
		$this->_Index();
	}
	public function quanbu() {
	    \Phpcmf\Service::V()->assign([
	        'meta_title' => dr_lang('全部圈子').SITE_SEOJOIN.SITE_NAME,
	        'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
	        'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
	    ]);
	    \Phpcmf\Service::V()->display('quanbu.html');
	}
	public function paiming() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		if (!$id) {
		exit($this->_msg(0, dr_lang('id参数不完整')));
		}
	    \Phpcmf\Service::V()->assign([
			'id' => $id,
	        'meta_title' => dr_lang('圈子用户排名').SITE_SEOJOIN.SITE_NAME,
	        'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
	        'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
	    ]);
	    \Phpcmf\Service::V()->display('paiming.html');
	}
	//跳转pc统计
	public function pc() {
	    $sitedata = \Phpcmf\Service::M()->db->table('site')->where('id', '1')->get()->getRowArray();
	    $tongjidata = dr_string2array($sitedata['tongji']);
	    $jia = $tongjidata['pc']+1;
	    $jiayidong = $tongjidata['yidong'];
	    //dr_debug('文件$jia', $jia);
	    $value = [
	        'pc'=>$jia,
	        'yidong'=> $jiayidong
	        ];
	    \Phpcmf\Service::M()->db->table('site')->where('id', '1')->update([
			'tongji' => dr_array2string($value)
		]);
		header("Location: https://gitee.com/duixincc/duixin/releases");  
	    exit; 
	}
	
	//跳转yidong统计
	public function yidong() {
	    $sitedata = \Phpcmf\Service::M()->db->table('site')->where('id', '1')->get()->getRowArray();
	    $tongjidata = dr_string2array($sitedata['tongji']);
	    $jia = $tongjidata['pc'];
	    $jiayidong = $tongjidata['yidong']+1;
	    //dr_debug('文件$jia', $jia);
	    $value = [
	        'pc'=>$jia,
	        'yidong'=> $jiayidong
	        ];
	    \Phpcmf\Service::M()->db->table('site')->where('id', '1')->update([
			'tongji' => dr_array2string($value)
		]);
		header("Location: https://gitee.com/duixincc/duixinvuechanpin/releases");  
	    exit; 
	}
	//管理申请用户
	public function guanli() {
		$quanid = (int)\Phpcmf\Service::L('input')->get('quanid');
		if (!$quanid) {
		exit($this->_msg(0, dr_lang('id参数不完整')));
		}
		$tablename='1_quan';
		$tabledata = \Phpcmf\Service::M()->db->table($tablename)->where('id', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		if(!$tabledata){
			exit($this->_msg(0, dr_lang('您不是此圈管理员')));
		}
	    \Phpcmf\Service::V()->assign([
			'id' => $id,
	        'meta_title' => dr_lang('管理申请用户').SITE_SEOJOIN.SITE_NAME,
	        'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
	        'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
	    ]);
	    \Phpcmf\Service::V()->display('guanli.html');
	}
	//圈子管理员列表
	public function guanlilist() {
		$id = (int)\Phpcmf\Service::L('input')->get('quanid');
		if (!$id) {
		exit($this->_msg(0, dr_lang('id参数不完整')));
		}
	    \Phpcmf\Service::V()->assign([
			'id' => $id,
	        'meta_title' => dr_lang('圈子管理员列表').SITE_SEOJOIN.SITE_NAME,
	        'meta_keywords' => $this->get_cache('site', SITE_ID, 'config', 'SITE_KEYWORDS'),
	        'meta_description' => $this->get_cache('site', SITE_ID, 'config', 'SITE_DESCRIPTION')
	    ]);
	    \Phpcmf\Service::V()->display('guanliyuan.html');
	}
	//实名发布弹窗接口
	public function shiming() {
		$this->_json(1, dr_lang('不需实名'));
	}

}
